package com.yyx.app1.My_function.UI;

import android.app.Activity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.yyx.app1.Data.My.Appointment_Data;
import com.yyx.app1.R;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

/**
 * Created by Administrator on 2015/10/24.
 */
@EActivity(R.layout.activity_appointmentinfo)
public class AppointmentInfo_Activity extends Activity {
    @ViewById
    TextView number,program,time,name,phone,petname,pettime,pettype,sec;

    @ViewById
    Button button_over;

    @AfterViews
    public void init()
    {
        Appointment_Data data = (Appointment_Data) getIntent().getExtras().getSerializable("data");
        number.setText(data.getNumber());
        program.setText(data.getProject());
        time.setText(data.getTime());
        name.setText(data.getUserName());
        phone.setText(data.getPhone());
        petname.setText(data.getPetName());
        pettime.setText(data.getPetTime());
        pettype.setText(data.getPetType());
        sec.setText(data.getPetsec());
        if (data.getStatus()== Appointment_Data.Appointment_Data_Type.End)
        {
            button_over.setVisibility(View.GONE);
        }
    }

    @Click
    public void home()
    {
        finish();
    }

    @Click
    public void button_over()
    {
        Toast.makeText(this,"行程结束",Toast.LENGTH_SHORT).show();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK)
        {
            home();
        }
        return true;
    }
}
